﻿/*----------------------------------------------------------------
//Copyright (C) 2012 赵国伟
//文件功能描述：咨询管理客户端脚本
//创建人：赵国伟
//生成时间：2012/03/17 16:15:00
//----------------------------------------------------------------*/
var AjaxServerUrl = "/Manage/AS/GoodsCommon.aspx";
var bianhao = 0;
var BaseData = new Array();
function GoToSearch() {
    var url = "ConsultManage.aspx?";
    url += "keyWords=" + escape($("#txtKeyWords").val().trim());
    url += "&Status=" + $("#ddlStatus").val();
    location.href = url;
}

function Init() {
    bianhao = 0;
}

///保存商品回复；
function SaveReply() {
    $("#btnSave").attr("disabled", true);
    if ($("#txtReplyContent").val().trim() == "") {
        alert("系统提示：请输入回复内容！" );
        $("#txtReplyContent").focus();
        $("#btnSave").attr("disabled", false);
        return false;
    }
   
    var url = AjaxServerUrl + "?Action=ReplyConsult";
    var postData = "GoodsConsultID=" + BaseData[bianhao].Consult._goodsconsultid;
    postData += "&ReplyContent=" + escape($("#txtReplyContent").val());
    AjaxPostEx(url, "btnSave", postData);  //更新数据；
    $("#btnSave").attr("disabled", false);

}

///执行删除
function Delete(id) {
    if (!confirm("系统提示：您确定要删除该条咨询信息吗？"))
        return;
    AjaxGet(AjaxServerUrl + "?Action=DeleteConsult&GoodsConsultID=" + id);
}


///打开商品回复界面；
function Reply(i) {
    Init();
    bianhao = i;
    GetPopupDiv(600, 800, "#e2e2e2", "商品咨询", GetHtmlForm());
}


function GetHtmlForm() {
    var html = new Array();
    var d = BaseData[bianhao];
    html.push("<form>");
    html.push("<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"table\">");
    html.push("  <tr>");
    html.push("    <td colspan=\"2\" class=\"TableHeadRow\">&gt;&gt;商品咨询回复</td>");
    html.push("  </tr>");
    html.push("  <tr>");
    html.push("    <td width=\"80\" align=\"right\">咨询商品：</td>");
    html.push("    <td>");
    html.push("<a href=\"/Show.aspx?GoodsID="+d.Consult._goodsid+"\" target=\"_blank\" title=\"查看商品详细信息\">")
    html.push(d.GoodsName);
    html.push("</a>");
    html.push("</td>");
    html.push("  </tr>");
    html.push("  <tr>");
    html.push("    <td align=\"right\">会员名称：</td>");
    html.push("    <td>");
    html.push("<a href=\"UsersManage.aspx?KeyWords=" + escape(d.UserName) + "\" target=\"_blank\" title=\"查看会员详细信息\">")
    html.push(d.UserName);
    html.push("</a>");
    html.push("</td>");
    html.push("  </tr>");
    html.push("  <tr>");
    html.push("    <td align=\"right\">咨询时间：</td>"); ConvertJsonDatetoToLocateDate
    html.push("    <td>");
    html.push(ConvertJsonDatetoToLocateDate2(d.Consult._consultdate));
    html.push("</td>");
    html.push("  </tr>");
    html.push("  <tr>");
    html.push("    <td  align=\"right\"><img src=\"/Manage/images/zixun.png\"> 咨询内容：</td>");
    html.push("    <td>");
    html.push(d.Consult._consultcontent);
    html.push("</td>");
    html.push("  </tr>");
   
    html.push("  <tr>");
    html.push("    <td align=\"right\"><img src=\"/Manage/images/reply.png\"> 回复内容：</td>");
    html.push("    <td><textarea name=\"txtReplyContent\" cols=\"80\" rows=\"3\" id=\"txtReplyContent\"></textarea></td>");
    html.push("  </tr>");
    html.push("  <tr>");
    html.push("    <td align=\"right\">&nbsp;</td>");
    html.push("    <td><input name=\"btnSave\" type=\"button\" id=\"btnSave\" value=\" 保 存 \" class=\"btn2\" onclick=\"SaveReply();\">");
    html.push("    <input name=\"btnReset\" type=\"reset\" id=\"btnReset\" value=\" 重 置 \" class=\"btn2\">");
    html.push("    <input name=\"btnClose\" type=\"button\" id=\"btnClose\" value=\"关闭本窗口\" class=\"btn2\" onclick=\"yesOther(false);\"></td>");
    html.push("  </tr>");
    html.push("</table>");
    html.push("</form>");

    return html.join("");

}







